#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
int main()
{
    int a = 0;
    int b = 0;
    int c = 0;
    char d = 0;
    scanf("%d-%d-%d-%c", &a, &b, &c, &d);
    int m = b;
    int n = c;
    int sum = a;
    for (int i = 4; i > 0 && m; i--)
    {
        sum += i * (m % 10);
        m /= 10;
    }
    for (int i = 9; i > 4 && n; i--)
    {
        sum += i * (n % 10);
        n /= 10;
    }
    if (sum % 11 == d - '0')
    {
        printf("Right\n");
    }
    else if (sum % 11 == 10 && d == 'X')
    {
        printf("Right\n");
    }
    else
    {
        int t = sum % 11;
        if (t == 10)
        {
            printf("%d-%d-%d-X\n", a, b, c);
        }
        else
        {
            printf("%d-%d-%d-%d\n", a, b, c, t);
        }
    }

    return 0;
}